function createRequest()
{
    try{
        request = new XMLHttpRequest();
    }catch(tryMS)
    {
        try{
            request = new ActiveXObject("Msxm12.XMLHTTP");
        }catch(otherMS){
            try{
                request = new ActiveXObject("Microsoft.XMLHTTP");
            }catch(failed){
                request = null;
            }
        }
    }
    return request;
}


function addEventHandler(obj, eventName,handler){
    if(document.attachEvent){
        obj.attachEvent("on"+eventName,handler);
    }else if(document.addEventListener){
        obj.addEventListener(eventName,handler,false);
    }
}

function getActivatedObject(e){
    var obj;
    if(!e){
        //primeira vers?o do ie n?o passa um objeto
        obj = window.event.srcElement;
    }else if(e.srcElement){
        //IE7 ou posterior
        obj = e.srcElement;
    }
    else{
        //para navegadores que implementam o DOM n?vel 2
        obj = e.target;
    }
   return obj; 
}


function getElements(tagName,type){
    
    var elements = document.getElementsByTagName(tagName);
    var element;
    var counter = 0;
    
    switch (type){
        case "":
            return elements;
            break;
        case "text":
            alert("text");
            break;
        case "submit":
            submits = new Array();
            for(var i=0;i<elements.length;i++){
                element = elements[i];
                if(element.type == "submit"){
                    submits[counter] = element;
                    counter = counter+1;
                }
            }
            
            
            return submits
            break;
    }
    
    return false;
}

/* ##################################################################*/
//ExpReg Validations

function validDDD(obj){
    var reg = /^\d{2,2}$/;
    return obj.match(reg);    
}


//End of ExpReg Validations
/* ##################################################################*/

function jQueryObjIsValid(obj){
    for(var i=0;i<(obj.value.length);i++){
        if(obj.value[i] == "_"){
            return false;
        }
    }
    
    return true;
}